package serializer

import "strconv"

type errorCode int

// 通用错误码
const (
	CodeOk           errorCode = 200
	CodeUnknownError errorCode = -1
)

// 错误码与描述信息map
var msgMap = map[errorCode]string{
	CodeOk:           "Success",       //"执行成功",
	CodeUnknownError: "Unknown error", //"未知错误",
}

// GetErrorMsg 根据错误码得到对应说明
func GetErrorMsg(code errorCode) string {
	msg, ok := msgMap[code]
	if !ok {
		msg = "unknown error，error code：" + strconv.Itoa(int(code))
	}
	return msg
}
